﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Kooboo.CMS.SiteConverter.Models
{
    public class HttpPostedFileCustomizable : System.Web.HttpPostedFileBase
    {
        public HttpPostedFileCustomizable() { }

        private string _fileName;
        private Stream _fileStream;
        public HttpPostedFileCustomizable(string fileName, Stream fileStream)
        {
            _fileName = fileName;
            _fileStream = fileStream;
        }

        public override string FileName
        {
            get
            {
                if (!string.IsNullOrEmpty(_fileName))
                    return _fileName;

                return base.FileName;
            }
        }

        public override Stream InputStream
        {
            get
            {
                if (_fileStream != null)
                    return _fileStream;

                return base.InputStream;
            }
        }

        public override int ContentLength
        {
            get
            {
                return base.ContentLength;
            }
        }

        public override string ContentType
        {
            get
            {
                return base.ContentType;
            }
        }

        public override void SaveAs(string filename)
        {
            base.SaveAs(filename);
        }
    }
}
